package com.chen.reggie.common;

/**
 * @ClassName BaseContext
 * @Description TODO
 * @Author hainc
 * @Date 2022/9/4 19:55
 * @Version 1.0
 **/
public class BaseContext {
    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    //保存当前用户id，放入到线程变量中
    public static void setCurrentId(Long id){
        threadLocal.set(id);
    }
    //从线程变量获取用户id
    public static Long getCurrentId(){
        return threadLocal.get();
    }
}
